package tr.gov.tubitak.bilgem.esya.crlviewer;

import sun.security.x509.CRLReasonCodeExtension;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: ramazan.girgin
 * Date: 4/18/12
 * Time: 11:14 AM
 * To change this template use File | Settings | File Templates.
 */
public class ERevocationInfo {
    String serialNumber;
    Date revocationDate;

    public Integer getReasonCode() {
        return reasonCode;
    }
    private Integer reasonCode;

    public String getReasonCodeStr(){
        String retStr = "";
        if(reasonCode==null){
            return Bundle.getString("ERevocationInfo.reasoncode.noinfo");
        }

        switch (reasonCode){
            case CRLReasonCodeExtension.UNSPECIFIED :
                return Bundle.getString("ERevocationInfo.reasoncode.unspecified");
            case CRLReasonCodeExtension.KEY_COMPROMISE:
                return Bundle.getString("ERevocationInfo.reasoncode.keypromise");
            case CRLReasonCodeExtension.CA_COMPROMISE:
                return Bundle.getString("ERevocationInfo.reasoncode.capromise");
            case CRLReasonCodeExtension.AFFLIATION_CHANGED:
                return Bundle.getString("ERevocationInfo.reasoncode.affliationchange");
            case CRLReasonCodeExtension.SUPERSEDED:
                return Bundle.getString("ERevocationInfo.reasoncode.superseed");
            case CRLReasonCodeExtension.CESSATION_OF_OPERATION:
                return Bundle.getString("ERevocationInfo.reasoncode.cessationofoperation");
            case CRLReasonCodeExtension.CERTIFICATE_HOLD:
                return Bundle.getString("ERevocationInfo.reasoncode.certificatehold");
            case CRLReasonCodeExtension.REMOVE_FROM_CRL:
                return Bundle.getString("ERevocationInfo.reasoncode.removefromcrl");
            case CRLReasonCodeExtension.PRIVILEGE_WITHDRAWN:
                return Bundle.getString("ERevocationInfo.reasoncode.privilagewithdraw");
            case CRLReasonCodeExtension.AA_COMPROMISE:
                return Bundle.getString("ERevocationInfo.reasoncode.aacomprimise");
            default:
                return Bundle.getString("ERevocationInfo.reasoncode.unknown");
        }
}

    public String getSerialNumber() {
        return serialNumber;
    }

    public Date getRevocationDate() {
        return revocationDate;
    }

    public ERevocationInfo(String serialNumber, Date revocationDate,Integer reasonCode) {
        this.serialNumber = serialNumber;
        this.revocationDate = revocationDate;
        this.reasonCode = reasonCode;
    }
}
